<!DOCTYPE html>
<html lang="en">
<head>
    <title>当月成交客户</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link href="/dist/plugins/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet"/>
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=4a6c1b54">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <style>
        .moduleName {
            height: 28px;
            line-height: 28px;
            font-size: 22px;
            border-bottom: 1px solid #ddd;
            text-align: center;

        }

        .tryStyle {
            width: 30px;
            height: 14px;
            line-height: 14px;
            font-size: 12px;
            /* top: 0; */
            right: 0;
            position: absolute;
            border-radius: 5px;
            margin-top: 1px;
            background: red;
            color: #fff;
            margin-right: -2px;
            transform: scale(0.8);
        }

        .nav-tabs-custom {
            padding: 10px 0;
            margin-bottom: 0;
            box-shadow: none;
            position: relative;
            overflow: hidden;
        }

        .infoReport {
            display: flex;
            justify-content: flex-start;
            text-align: left;
            margin-left: 10px;
        }

        .infoReport div {
            margin: 0 10px;
        }

        .lineOne {
            text-align: left;
        }

        .lineOne span {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }

        .lineOneNoMore {
            text-align: left;
        }

        .lineOneNoMore span {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }

        .mScrollBox {
            float: left;
            position: relative;
        }

        .imgStyle {
            width: 300px;
            height: 400px;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }

        .templateStyle {
            border: 1px solid #ddd;
            /*margin-bottom: 10px;*/
            padding: 0 10px;
        }

        .table > thead > tr > th {
            padding: 0;
        }

        .table > tbody > tr > td {
            position: relative;
        }

        .selectBox {
            height: 25px;
            margin-bottom: 10px;
        }

        .span-a-btn {
            position: absolute;
            right: 10px;
            top: 18px;
        }

        .table-width {
            width: 35%;
            float: left;
        }

        .remark {
            margin-left: 10px;
        }
        .left{
            width:150px;
            float: left;
        }
        .right{
            margin-left: 160px;
        }
        .row{
            margin-right: -5px;
            margin-left: -5px;
        }
    </style>
</head>
<body>
<section class="content" id="app" v-cloak>
    <div class="div-td-content-more"><i></i></div>
    <div class="row">
        <div class="templateStyle iframeH" style="overflow-y: auto;">
            <div class="nav-tabs-custom">

            </div>
            <div class="row" >
                <div class="col-md-7">
                    <table class="table table-bordered text-center table-width" style="width: 100%; margin-bottom: 10px;">
                        <thead>
                        <tr>
                            <th rowspan="2" style="width: 120px">省份</th>
                            <th rowspan="2" style="width: 120px">大区经理</th>
                            <th rowspan="2" style="width: 120px">当月交机目标</th>
                            <th colspan="3" style="width: 150px">成交概率</th>
                            <th rowspan="2">预测合计</th>
                        </tr>
                        <tr>
                            <th>50%</th>
                            <th>75%</th>
                            <th>100%</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr v-for="(item,i) in list">
                            <td>
                                {{item.companyName}}
                            </td>
                            <td>
                               {{item.name}}
                            </td>
                            <td>
                                {{item.currentMonthTarget == "" ? "-" : item.currentMonthTarget}}
                            </td>
                            <td>
                                {{item.percent50 == "" ? "-" : item.percent50}}
                            </td>
                            <td>
                                {{item.percent75 == "" ? "-" : item.percent75}}
                            </td>
                            <td>
                                {{item.percent100 == "" ? "-" : item.percent100}}
                            </td>
                            <td>
                                {{item.total == "" ? "-" : item.total}}
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">合计</td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                        </tr>
                        </tbody>
                    </table>

                </div>
                <div class="col-md-5">
                    <table class="table table-bordered text-center table-width" style="width: 100%;"
                           v-for="(item,i) in accuracyRateList">
                        <thead>
                        <tr><th colspan="6">准确率预测表</th></tr>
                            <tr >
                                <th style="width: 50px">{{item.companyName}}</th>
                                <th style="width: 120px">零售预测</th>
                                <th style="width: 120px">实际销售</th>
                                <th style="width: 50px">准确率</th>
                                <th style="width: 50px">80%</th>
                                <th style="width: 50px">120%</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>{{Number(new Date().Format("M"))}}月</td>
                                <td>{{item.forcastCountFirst}}</td>
                                <td>{{item.realSaleCountFirst}}</td>
                                <td></td>
                                <td></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>{{Number(new Date().Format("M"))+1}}月</td>
                                <td>{{item.forcastCountSecond}}</td>
                                <td>{{item.realSaleCountSecond}}</td>
                                <td></td>
                                <td></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>{{Number(new Date().Format("M"))+2}}月</td>
                                <td>{{item.forcastCountThree}}</td>
                                <td>{{item.realSaleCountThree}}</td>
                                <td></td>
                                <td></td>
                                <td></td>
                            </tr>
                        </tbody>
                    </table>

                </div>
            </div>
            <div class="row" >
                <div class="col-md-12">
                    <table class="table table-bordered text-center table-width" style="    width: 100%;margin-bottom: 10px;">
                        <thead>
                        <tr><th colspan="11">明细信息</th></tr>
                        <tr>
                            <th style="width: 80px">省份</th>
                            <th style="width: 80px">大区经理</th>
                            <th style="width: 80px">区域</th>
                            <th style="width: 80px">区域经理</th>
                            <th style="width: 80px">品牌</th>
                            <th style="width: 90px">机型</th>
                            <th style="width: 80px">意向客户</th>
                            <th style="width: 60px">成交概率</th>
                            <th style="width: 60px">交机日期</th>
                            <th style="width: 60px">是否置换</th>
                            <th>基本情况描述</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr v-for="(item,i) in dealList">
                            <td>{{delEn(item.companyName)}}</td>
                            <td>{{item.bigRegionalManagerName}}</td>
                            <td>{{item.bigRegionalName}}</td>
                            <td>{{item.regionalManagerName}}</td>
                            <td>{{item.brandName}}</td>
                            <td>{{item.needModel}}</td>
                            <td>{{item.customerName}}</td>
                            <td>{{item.transactionProbability}}</td>
                            <td>{{item.deliveryDate}}</td>
                            <td>{{item.replacementModel}}</td>
                            <td>{{item.otherInformation}}</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <!--<div class="remark" style="float: left;">-->
            <!--<p>填写说明：</p>-->
            <!--<p>1、此表每周五由大区经理填写：已售设备、截止到本月末及未来两个月的销售预测；</p>-->
            <!--<p>2、本周有成交的，将成交机型*台数填写到“实际销售台数”；</p>-->
            <!--<p>3、销售总监审核无误后由销售管理经理试用销售部公共邮箱发送给武帅、张驰，抄送给潘奇、曹国玉、贾贤达、谈总。</p>-->
            <!--</div>-->
            <!--<div class="div-btn text-center" style="padding-bottom: 10px;">
                <input type="button" style="margin-left:20px;" value="保存草稿" class="btn btn-primary btn-sm" @click="save(0)">
                <input type="button" style="margin-left:20px;" class="btn btn-primary btn-sm" value="提交">
            </div>-->
        </div>
    </div>
    <!--</div>-->
    </div>
</section>
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=8e743a31"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=54c6b89c"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<!--ztree组件所需js-->
<script type="text/javascript" src="/dist/plugins/ztree/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="/dist/plugins/ztree/js/jquery.ztree.exhide-3.5.js"></script>
<script type="text/javascript">
    var zTreeCallback = {
        showIcon: function (treeeId, treeNode) {
            return treeNode.isParent;
        },
        onClick: function (event, treeId, treeNode) {
            console.log(treeNode.type)
            if (treeNode.type == "region") {
                console.log(treeNode.type)
                app.regionId=treeNode.id;
                app.companyId=treeNode.id;
                app.getSelect();
            }
        },
        beforeClick:function (treeId, treeNode, clickFlag) {
            if(treeNode.level==0){
                return false;
            }
        }
    };
    var zTreeSetting = {
        view: {
            showIcon: zTreeCallback.showIcon
        },
        data: {
            simpleData: {
                enable: true
            },
            keep: {
                parent: true
            }
        },
        callback: {
            onClick: zTreeCallback.onClick,
            beforeClick:zTreeCallback.beforeClick
        }
    };

</script>
<script type="text/javascript">
    var app = new Vue({
        el: '#app',
        data: {
            list:[],
            dealList:[],
            accuracyRateList:[],
            searchParams: {
                userId: $.wyui.page.urlParams.userId ? $.wyui.page.urlParams.userId : getCurrentUser().id,
                companyId:$.wyui.page.urlParams.companyId,
                bigRegionalId: '',
                regionalManagerId: '',
                dateTime: new Date().Format("yyyy年M月")
            },
            currentUser: getCurrentUser(),
            main: {
                actualSaleRemark: '',
                firstMonth: '',
                secondMonth: '',
                thirdMonth: '',
                firstMonthBef:'',
                secondMonthBef:'',
                thirdMonthBef:'',
                day:new Date().Format("yyyy-MM-dd")
            },
            sub: [],
            getAll: {},
            companyName: '',
            companyId: '',
            regionName: '',
            regionId: '',
            date: new Date().Format("yyyy-MM-dd"),
            beforeWeek: '',
        },
        methods: {
            //去掉英文
            delEn: function (str) {
                var reg = /[a-zA-Z]/g;
                return str.replace(reg, "");
            },
            //获取合计
            getCount: function (arr, key) {
                var number = 0;
                for (var i = arr.length - 1; i >= 0; i--) {
                    number += (arr[i][key] && arr[i][key] != '-' ? arr[i][key] : 0)

                }
                return number;
            },
            //合并单元格
            tablesMergeCell: function (list) {
                for (field in list[0]) {
                    var k = 0;
                    while (k < list.length) {
                        list[k][field + 'span'] = 1;
                        list[k][field + 'dis'] = false;
                        for (var i = k + 1; i <= list.length - 1; i++) {
                            if (list[k][field] == list[i][field] && list[k][field] != '') {
                                list[k][field + 'span']++;
                                list[k][field + 'dis'] = false;
                                list[i][field + 'span'] = 1;
                                list[i][field + 'dis'] = true;
                            } else {
                                break;
                            }
                        }
                        k = i;
                    }
                }
                return list;
            },
            //初始化时间控件
            showDatePicker: function (e, type) {
                var that = this;
                WdatePicker({
                    onpicked: function (dp) {
                        that.selectParameter.day = dp.cal.getNewDateStr();
                        return true;
                    },
                    maxDate: new Date().Format("yyyy-MM-dd")//今天
                });
                $(e.target).blur();
            },
            getSelect: function () {
                var that = this;
                $.wyui.postMethod(urlConfig.yuce.select, {
                    userId: getCurrentUser().id,
                    companyId: that.companyId,
                    regionId: that.regionId,
                    date: that.date
                }, function (data) {
                    console.log(data)
                    that.sub = data.sub;
                    that.main = data.main;
                    if(!that.main.day){
                        that.main.day=new Date().Format("yyyy-MM-dd")
                        that.main.firstMonth=new Date().Format("yyyy-MM");
                        that.main.secondMonth=(that.getNextMonth(new Date().Format("yyyy-MM-dd"))).substring(0,7)
                        that.main.thirdMonth=(that.getNextMonth(that.getNextMonth(new Date().Format("yyyy-MM-dd")))).substring(0,7)
                    }
                    that.getAll.firstMonthYuce = that.getCount(that.sub, "firstMonth");
                    that.getAll.secondMonthYuce = that.getCount(that.sub, "secondMonth");
                    that.getAll.thirdMonthYuce = that.getCount(that.sub, "thirdMonth");
                });
            },
            //获取下个月
            getNextMonth: function (date) {
                var arr = date.split('-');
                var year = arr[0]; //获取当前日期的年份
                var month = arr[1]; //获取当前日期的月份
                var day = arr[2]; //获取当前日期的日
                var days = new Date(year, month, 0);
                days = days.getDate(); //获取当前日期中的月的天数
                var year2 = year;
                var month2 = parseInt(month) + 1;
                if (month2 == 13) {
                    year2 = parseInt(year2) + 1;
                    month2 = 1;
                }
                var day2 = day;
                var days2 = new Date(year2, month2, 0);
                days2 = days2.getDate();
                if (day2 > days2) {
                    day2 = days2;
                }
                if (month2 < 10) {
                    month2 = '0' + month2;
                }

                var t2 = year2 + '-' + month2 + '-' + day2;
                return t2;
            },
            save: function (type) {
                var that = this;
                that.main.day = that.getWeek(new Date().Format("yyyy-MM-dd"),4);
                that.main.createUserId = getCurrentUser().id;
                that.main.companyId = that.companyId;
                that.main.bigRegionId = that.regionId;
                $.wyui.postMethod(urlConfig.yuce.save, trimRN({
                    main: that.main,
                    sub: that.sub,
                    firstMonthYuce:that.getAll.firstMonthYuce,
                    secondMonthYuce:that.getAll.secondMonthYuce,
                    thirdMonthYuce:that.getAll.thirdMonthYuce,
                    firstMonthSub:Math.abs(Number(that.getAll.firstMonthYuce)-Number(that.main.firstMonthBef)),
                    secondMonthSub:Math.abs(Number(that.getAll.secondMonthYuce)-Number(that.main.secondMonthBef)),
                    thirdMonthSub:Math.abs(Number(that.getAll.thirdMonthYuce)-Number(that.main.thirdMonthBef)),
                    //beforeWeek: that.beforeWeek
                }), function (data) {
                    console.log(data);
                })
            },
            //获取周五
            getWeek: function (date,i) {
                var now = stringToDate(date)
                var firstDay=new Date(now - (now .getDay() - 1 ) * 86400000);
                firstDay.setDate(firstDay.getDate() + i);
                mon = Number(firstDay.getMonth()) + 1;
                day=firstDay.getDate()
                if(mon<10){
                    mon="0"+mon
                }
                if(day<10){
                    day="0"+day
                }
                return now .getFullYear() + "." + mon + "." + day;
            },
            //截取日期
            jqDate: function (dates) {
                var that = this;
                var num = dates.substring(5,7);
                num = Number(num);
                return num + "月"
            },
            //获取树
            getTreeData:function () {
                var that=this;
                $.wyui.postMethod(urlConfig.yuce.getCompanyRegionTree, {
                    userId:getCurrentUser().id,
                    date:new Date().Format("yyyy-MM-dd")
                }, function (nodes) {
                    console.log(nodes)
                    for(var i=0;i<nodes.length;i++){
                        if(nodes[i].name=='重庆迎风'){
                            nodes.splice(i,1);
                        }
                    }
                    that.treeObj = $.fn.zTree.init($("#ztree"), zTreeSetting, nodes);
                });
            },
        },
        mounted: function () {
            //this.getTreeData();
            var that = this;
            $.wyui.postMethod(urlConfig.thursday.getCurrMonthDeal, {
                userId:getCurrentUser().id,
                dateTime:new Date().Format("yyyy年M月")
            }, function (data) {
                console.log(data)
                that.list = data.records;
                console.log(that.list)
            });
            $.wyui.postMethod(urlConfig.thursday.getCurrMonthList, {
                userId:that.searchParams.userId,
                dateTime:that.searchParams.dateTime,
                companyId:that.searchParams.companyId,
                regionalManagerId:that.searchParams.regionalManagerId,
                bigRegionalId:that.searchParams.bigRegionalId
            }, function (data) {
                console.log(data)
                that.dealList = data.records;
                console.log(that.dealList)
            });
            $.wyui.postMethod(urlConfig.thursday.getAccuracyRate, {
                userId:that.searchParams.userId,
                dateTime:that.searchParams.dateTime
            }, function (data) {
                console.log(data)
                that.accuracyRateList = data.records;
                console.log(that.accuracyRateList)
            });
        }
    });
</script>
</body>
</html>